package com.huihui.vueadminapi.entity;

import java.util.ArrayList;
import java.util.Date;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;

/**
 * (SysMenu)表实体类
 *
 * @author liyonghui
 * @since 2022-04-14 14:09:14
 */
@EqualsAndHashCode(callSuper = true)
@Data
@ApiModel(description = "")
@SuppressWarnings("serial")
public class SysMenu extends Model<SysMenu> implements Serializable {
    private static final long serialVersionUID = 837566818131180301L;

    @ApiModelProperty("主键ID")
    @TableId(value="id",type= IdType.AUTO)
    private Long id;

    @NotNull(message = "上级菜单不能为空")
    @ApiModelProperty("父菜单ID，一级菜单为0")
    private Long parentId;

    @NotBlank(message = "菜单名称不能为空")
    @ApiModelProperty("菜单名称")
    private String name;

    @ApiModelProperty("菜单URL")
    private String path;

    @NotBlank(message = "菜单授权码不能为空")
    @ApiModelProperty("授权(多个用逗号分隔，如：user:list,user:create)")
    private String perms;

    @ApiModelProperty("$column.comment")
    private String component;

    @NotNull(message = "菜单类型不能为空")
    @ApiModelProperty("类型     0：目录   1：菜单   2：按钮")
    private Integer type;

    @ApiModelProperty("菜单图标")
    private String icon;

    @TableField("orderNum")
    @ApiModelProperty("排序")
    private Integer ordernum;

    @ApiModelProperty("创建时间")
    private Date created;

    @ApiModelProperty("更新时间")
    private Date updated;

    @ApiModelProperty("状态")
    private Integer statu;


    @TableField(exist = false)
    private List<SysMenu> children = new ArrayList<>();
}

